// ml:run = $bin < input
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>

int const maxn = 2000009;
int id[maxn];
int len[maxn];
int n;
std::vector<std::string> da;

int main()
{
    std::ios::sync_with_stdio(false);
    std::cin >> n;
    da.resize(n);
    auto tot = 0;
    for (int i = 0, k; i < n; i++) {
        std::cin >> da[i];
        std::cin >> k;
        for (int j = 0, p; j < k; j++) {
            std::cin >> p;
            if (!id[p] || len[p] < (int)da[i].size()) {
                id[p] = i;
                len[p] = da[i].size();
            }
            tot = std::max(tot, p + (int)da[i].size() - 1);
        }
    }
    std::string ans(tot, 'a');
    auto cur = -1;
    auto cur_len = 0;

    // for (int i = 0; i < tot; i++) std::cout << id[i] << " "; std::cout << "\n";
    // for (int i = 0; i < tot; i++) std::cout << len[i] << " "; std::cout << "\n";

    for (auto i = 0; i < tot; i++) {
        if (len[i + 1] > cur_len) {
            cur = id[i + 1];
            cur_len = len[i + 1];
        }
        if (cur_len > 0) {
            auto pos = da[cur].size() - cur_len;
            ans[i] = da[cur][pos];
        }
        cur_len = std::max(0, cur_len - 1);
    }
    std::cout << ans << "\n";
}

